<!DOCTYPE html>
<html lang="en">
<html>
<head>
    <title>健康资讯</title>
    <titleType style="display: none;">sc</titleType>
    <meta name="content-type" content="text/html; charset=UTF-8">
    <%- include('../../../_global/baseLibs') %>
    <style type="text/css">
        .biaoti{
            width:100%;
            height : auto;
            margin-top : 20px;
            text-align :center
        }
        .biaoti b {
            font-size: 22px;
        }
        .photo {
            width:98%;
            height : auto;
            margin:20px auto;
            text-align :center;
        }
        img {
            width:98%;
            height : auto;
            margin:20px auto;
            text-align :center;
        }

        p{
            width:100%;
            height : auto;
            text-align :left;
            text-indent:20px;
        }
        .text {
            padding: 0 15px;
        }
        h1 span {
            font-size: 16px;
        }
    </style>
</head>

<body>
<section class="page-wrap page-treatment">
    <header class="header-box fixed grey ">
        <div class="header-content">
            <div class="left-tool">
                <a class="back" href="javascript:void(0);"><i class="iconfont icon-back"></i></a>
            </div>
            <div class="right-tool">
                <a href="javascript:void(0);"><i class="sc-icon"></i></a>
            </div>
            <div class="title">资讯内容</div>
        </div>
    </header>
    <aside id="jkzxDetail"></aside>
</section>

<script type="text/javascript">
    //var sfsc = [[${zxsc}]];
    var sfsc=null;
</script>

<!-- 资讯列表显示容器 模板  start -->
<script type="text/html" id="templateJkzxDetail">
    <div class="biaoti" style = "text-align: center"><b>{{btmc}}</b></div>
    <div class = "text">{{@btnr}}</div>
</script>
<!-- 资讯列表显示容器 end -->


<script type="text/javascript">


    var page_jkzxContent = (function($, page_jkzxContent) {
        /*登录地址*/
        var uri_service_getNewsDetail="/api/gzd/jkzx/getNewsDetail";

        var sfsc;




        function initView(){
            /**收藏按钮*/
            $(".sc-icon").on("click", page_jkzxContent.scFunction);
        }
        function initData(){

            var nrid = $.QuickUrlUtils.getRequest('nrid');

            setTimeout(function(){
                page_jkzxContent.loadScImg();
            },500);

            if(nrid!==undefined){
                $.QuickRemote.AjaxJson({
                    funcName: uri_service_getNewsDetail ,
                    params: {nrid:nrid},
                    callback: page_jkzxContent.queryDataHandler
                });
            }

        };

        function queryDataHandler(result){

            var html = template("templateJkzxDetail",result);

            $('#jkzxDetail').html(html);
        }

        /**收藏方法*/
        function  scFunction(){
            var params = {};
            var code =   StoreCache.getCache("ZXXQ_CODE");
            console.log(sfsc);
            params["sfsc"] = sfsc;
            params["code"] = code;
            $.QuickRemote.AjaxJson("/api/jkcsHt/jkzx/saveJkzxScInfo", function(result) {
                if(result["code"] == "0"){
                    if(sfsc == 0){
                        sfsc = 1;
                    }else{
                        sfsc = 0;
                    }
                    page_jkzxContent.loadScImg();
                }else{
                    var content = "";
                    if(sfsc == 0){
                        content = "收藏资讯失败！";
                    }else{
                        content = "取消收藏资讯失败！";
                    }
                    console.log(content);
                    $.QuickAlert.alertFail({
                        content : content
                    });
                }
            }, params);
        }

        /**加载收藏图片*/
        function loadScImg(){
            $.JkcsUtils.loadScImg(sfsc);
        }
        var cfg_def = {
            /*登录按钮回调*/
            initView: initView,
            initData: initData,
            queryDataHandler: queryDataHandler,
            scFunction: scFunction,
            loadScImg: loadScImg,
        }

        page_jkzxContent.init = function(cfg){
            $.extend(page_jkzxContent, cfg_def, cfg);
            page_jkzxContent.initView();
            page_jkzxContent.initData();
        }
        /*初始化页面一般操作*/


        return page_jkzxContent;
    })(jQuery, {});

</script>
</body>
</html>
